#!/usr/bin/env node

const cp = require('child_process')
console.log(`Im child process:${process.pid}`);

process.on('message',(data)=>{
  console.log(`I have son:${data}`);
});


let son = cp.fork('./11-ipc-child.js'),
    dau = cp.fork('./11-ipc-child.js');

setTimeout(()=>{
  son.send('Good Good study');
},2000);
setTimeout(()=>{
  dau.send('Day Day up');
},3000);

setTimeout(()=>{
  son.kill('SIGINT');
  dau.kill('SIGINT');
},5000);
